package com.kgc.scd.controller;

import com.kgc.scd.bean.SearchHistory;
import com.kgc.scd.contant.SearchHistoryConstant;
import com.kgc.scd.producer.SearchHistoryProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created On : 2022/6/11.
 * <p>
 * Author     : hi
 * <p>
 * Description: SearchHistoryController
 */
@RestController
public class SearchHistoryController {
    @Autowired
    SearchHistoryProducer searchHistoryProducer;


    @PostMapping("/addSearchHistory")
    public String addSearchHistory(@RequestParam("queue") String queue, @RequestBody SearchHistory searchHistory){
        searchHistoryProducer.sendP2P(SearchHistoryConstant.Search_History_ADD_P2P,searchHistory);
        return "添加成功";
    }

    @PostMapping("/delSearchHistory")
    public String delSearchHistory(@RequestParam("del") String del, @RequestBody String historyValue){
        searchHistoryProducer.delP2P(SearchHistoryConstant.Search_History_DEl_P2P,historyValue);
        return "删除成功";
    }

}
